﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
	<title>Untitled Page</title>
</head>
<body>
	<form id="form1" runat="server">
	<asp:ScriptManager ID="ScriptManager1" runat="server">
	</asp:ScriptManager>
	<div>
		<asp:UpdatePanel ID="UpdatePanel1" runat="server">
			<ContentTemplate>
				<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:AdventureWorks_DataConnectionString %>"
					SelectCommand="SELECT [ProductID], [Name], [ProductNumber], [MakeFlag], [SafetyStockLevel], [ReorderPoint] FROM [Production].[Product]"
					DeleteCommand="DELETE FROM [Production].[Product] WHERE [ProductID] = @ProductID"
					InsertCommand="INSERT INTO [Production].[Product] ([Name], [ProductNumber], [MakeFlag], [SafetyStockLevel], [ReorderPoint]) VALUES (@Name, @ProductNumber, @MakeFlag, @SafetyStockLevel, @ReorderPoint)"
					
                    UpdateCommand="UPDATE [Production].[Product] SET [Name] = @Name, [ProductNumber] = @ProductNumber, [MakeFlag] = @MakeFlag, [SafetyStockLevel] = @SafetyStockLevel, [ReorderPoint] = @ReorderPoint WHERE [ProductID] = @ProductID">
					<DeleteParameters>
						<asp:Parameter Name="ProductID" Type="Int32" />
					</DeleteParameters>
					<UpdateParameters>
						<asp:Parameter Name="Name" Type="String" />
						<asp:Parameter Name="ProductNumber" Type="String" />
						<asp:Parameter Name="MakeFlag" Type="Boolean" />
						<asp:Parameter Name="SafetyStockLevel" Type="Int16" />
						<asp:Parameter Name="ReorderPoint" Type="Int16" />
						<asp:Parameter Name="ProductID" Type="Int32" />
					</UpdateParameters>
					<InsertParameters>
						<asp:Parameter Name="Name" Type="String" />
						<asp:Parameter Name="ProductNumber" Type="String" />
						<asp:Parameter Name="MakeFlag" Type="Boolean" />
						<asp:Parameter Name="SafetyStockLevel" Type="Int16" />
						<asp:Parameter Name="ReorderPoint" Type="Int16" />
					</InsertParameters>
				</asp:SqlDataSource>
				<asp:GridView ID="GridView1" runat="server" AllowPaging="True" AllowSorting="True"
					AutoGenerateColumns="False" DataKeyNames="ProductID" DataSourceID="SqlDataSource1"
					BackColor="#DEBA84" BorderColor="#DEBA84" BorderStyle="None" BorderWidth="1px"
					CellPadding="3" CellSpacing="2" OnRowDataBound="GridView1_RowDataBound" OnSelectedIndexChanged="GridView1_SelectedIndexChanged">
					<FooterStyle BackColor="#F7DFB5" ForeColor="#8C4510" />
					<RowStyle BackColor="#FFF7E7" ForeColor="#8C4510" />
					<Columns>
						<asp:BoundField DataField="ProductID" HeaderText="ProductID" InsertVisible="False"
							ReadOnly="True" SortExpression="ProductID" />
						<asp:BoundField DataField="Name" HeaderText="Name" SortExpression="Name" />
						<asp:BoundField DataField="ProductNumber" HeaderText="ProductNumber" SortExpression="ProductNumber" />
						<asp:CheckBoxField DataField="MakeFlag" HeaderText="MakeFlag" SortExpression="MakeFlag" />
						<asp:BoundField DataField="SafetyStockLevel" HeaderText="SafetyStockLevel" SortExpression="SafetyStockLevel" />
						<asp:BoundField DataField="ReorderPoint" HeaderText="ReorderPoint" SortExpression="ReorderPoint" />
					</Columns>
					<PagerStyle ForeColor="#8C4510" HorizontalAlign="Center" />
					<SelectedRowStyle BackColor="#738A9C" Font-Bold="True" ForeColor="White" />
					<HeaderStyle BackColor="#A55129" Font-Bold="True" ForeColor="White" />
				</asp:GridView>
				<asp:Label ID="Label1" runat="server" Text="Name"></asp:Label>
				<asp:TextBox ID="txtName" runat="server" ReadOnly="True"></asp:TextBox>
			</ContentTemplate>
		</asp:UpdatePanel>
	</div>
	</form>
</body>
</html>
